<?php
$key = $form_view_config['key'];
$obj = $result;
if(!empty($form_view_config['file_config'])){
	$file_config = $form_view_config['file_config'];
	$file_src = !empty($obj->$key) ? PATH_URL.$file_config['file_dir_path'].$obj->$key : '';
	$file_type = $file_config['file_type'];
	$file_width = !empty($form_view_config['file_width']) ? $form_view_config['file_width'] : (!empty($file_config['file_width']) ? $file_config['file_width'] : 0);
	$file_height = !empty($form_view_config['file_height']) ? $form_view_config['file_height'] : (!empty($file_config['file_height']) ? $file_config['file_height'] : 0);	
	$file_width_attr = !empty($file_width) ? "width='{$file_width}'" : '';
	$file_height_attr = !empty($file_height) ? "height='{$file_height}'" : '';
?>
<div class="row_text_field">
	<table cellspacing="0" cellpadding="0" border="0" width="100%">
		<tr>
			<td class="left_text_field"><?=$form_view_config['text']?>:</td>
			<?php 
			if($file_type == 'image') {
			?>
			<td class="right_text_field">
				<input type="file" name="<?=$form_view_config['input_name']?>" /><div style="clear:both;padding-top:5px;"></div>
				<?php
				if(!empty($file_src)){
				?> 
					<a class="fancyboxClick" href="<?=$file_src?>"><img src="<?=$file_src?>" <?=$file_width_attr?> <?=$file_height_attr?> /></a>
					<input type="checkbox" name="delete_<?=$form_view_config['input_name']?>" value="1" /> Delete Image
				<?php
				}
				?>
			</td>
			<?php 
			} else if($file_type == 'audio') {
			?>
				<td class="right_text_field"><input type="file" name="<?=$form_view_config['input_name']?>" />
					Only support (mp3)
					<?php 
					if(!empty($file_src)){
					?>
					- 
					<p id="audioplayer_<?=$form_view_config['input_name']?>"></p> 
					<script type="text/javascript">  
					AudioPlayer.embed("audioplayer_<?=$form_view_config['input_name']?>", {soundFile: "<?=$file_src?>"});  
					</script>
					<?php 
					}
					?>
				</td>
			<?php 
			} else if($file_type == 'video'){
			?>
				<td class="right_text_field">
					<input type="file" name="<?=$form_view_config['input_name']?>" />Only support FLV and MP4 
				<?php 
				if(!empty($file_src)){
				?> 
					- 
					<!--Video review-->
					<a href="#videoplayer_container_<?=$form_view_config['input_name']?>" rel="videoplayer<?=$form_view_config['input_name']?>" class="video-fancy" >Play Video</a>
					<div style="display: none">
						<div id="videoplayer_container_<?=$form_view_config['input_name']?>">
							<p id="videoplayer_<?=$form_view_config['input_name']?>">Please install the Flash Plugin</p>

							<script type="text/javascript">
							  var flashvars = { file:'<?=$file_src?>',autostart:'false' };
							  var params = { allowfullscreen:'true', allowscriptaccess:'always' };
							  var attributes = { id:'videoplayer<?=$form_view_config['input_name']?>', name:'videoplayer<?=$form_view_config['input_name']?>' };

							  swfobject.embedSWF(root+'static/js/admin/player.swf','videoplayer_<?=$form_view_config['input_name']?>','<?=$file_width?>','<?=$file_height?>','9.0.115','false',
								flashvars, params, attributes);
							</script>
						</div>
					</div>
				<?php
				}
				?>
				</td>
			<?php 
			}
			?>
		</tr>
	</table>
</div>
<?php
}
?>

